inline
RWThreadMutex::RWThreadMutex ()
{
    pthread_rwlock_init (&this->rwlock_, NULL);
}
inline
RWThreadMutex::~RWThreadMutex ()
{
    pthread_rwlock_destroy(&this->rwlock_);
}
inline
int RWThreadMutex::acquire_read (void)
{
    int result = pthread_rwlock_rdlock(&this->rwlock_);
    if (result != 0)
    {
        errno = result;
        return -1;
    }
    return 0;
}
inline
int RWThreadMutex::acquire_write (void)
{
    int result = pthread_rwlock_wrlock(&this->rwlock_);
    if (result != 0)
    {
        errno = result;
        return -1;
    }
    return 0;
}
inline
int RWThreadMutex::tryacquire_read (void)
{
    int result = pthread_rwlock_tryrdlock(&this->rwlock_);
    if (result != 0)
    {
        errno = result;
        return -1;
    }
    return 0;
}
inline
int RWThreadMutex::tryacquire_write (void)
{
    int result = pthread_rwlock_trywrlock(&this->rwlock_);
    if (result != 0)
    {
        errno = result;
        return -1;
    }
    return 0;
}
inline
int RWThreadMutex::release (void)
{
    int result = pthread_rwlock_unlock (&this->rwlock_);
    if (result != 0)
    {
        errno = result;
        return -1;
    }
    return 0;
}

